<p id="notice"><h3><%= notice %></h3></p>
<table border = "1">
	<thead>
    	<tr>
			<th><h4>Patient's Detail</h4></th>
			<th><h4>Address</h4></th>
		</tr>
	</thead>
	
	<tbody>
		<tr>
        	<td>
				<p>
					<strong>Patient's name: </strong><%= @patient.full_name %></br>
					<strong>Date of Brthday: </strong><%= @patient.dob %></br>
					<strong>Mobile: </strong><%= @patient.mobile %></br>
					<strong>Email: </strong><%= @patient.email %></br>
				</p>
				<p>
					<%= link_to 'Edit Patient', edit_patient_path(@patient) %> |
					<%= link_to 'Destroy', Patient, method: :delete, data: { confirm: 'Are you sure?' } %>
				</p>
			</td>
			<td>
      			<%= render @patient.contacts %>			
				<p>
					<%= link_to 'Add New Address', new_patient_contact_path(:patient_id => params[:id]) %> 
				</p>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<h4>Appointment's History</h4></br>
				<table>
					<tr>
						<th>Patient</th>
						<th>Staff</th>
						<th>Date</th>
						<th>Appointment status</th>
						<th>Registration method</th>
						<th colspan="3"></th>
					</tr>
  
					<% @appointments.each do |appointment| %>
					<tr>
						<td><%= appointment.patient.full_name %></td>
						<td><%= appointment.staff.full_name %></td>
						<td><%= appointment.date %></td>
						<td><%= appointment.appointment_status.label %></td>
						<td><%= appointment.registration_method.label %></td>
						<td><%= link_to 'Show', appointment %></td>
						<td><%= link_to 'Edit', edit_appointment_path(appointment) %></td>
						<td><%= link_to 'Destroy', appointment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
					</tr>
					<% end %>
				</table>
			</td>
		</tr>
</table>

<%= link_to 'Back to Patients list', patients_path %> |
<%= link_to 'Back to New Appointment', new_appointment_path %> |
<%= link_to 'Back to Appointments List', appointments_path %>
